<?php

/**
 * This is the model class for table "{{point}}".
 *
 * The followings are the available columns in table '{{point}}':
 * @property double $id
 * @property double $student_id
 * @property double $exam_id
 * @property double $subject_id
 * @property double $score
 * @property string $number
 * @property double $score1
 * @property double $score2
 * @property double $school_id
 * @property double $create_user
 * @property double $create_time
 * @property double $update_user
 * @property double $update_time
 */
class Point extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Point the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{point}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('student_id, exam_id, subject_id, score, score1, score2, school_id, create_user, create_time, update_user, update_time', 'numerical'),
			array('number', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, student_id, exam_id, subject_id, score, number, score1, score2, school_id, create_user, create_time, update_user, update_time', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'student_id' => 'Student',
			'exam_id' => 'Exam',
			'subject_id' => 'Subject',
			'score' => 'Score',
			'number' => 'Number',
			'score1' => 'Score1',
			'score2' => 'Score2',
			'school_id' => 'School',
			'create_user' => 'Create User',
			'create_time' => 'Create Time',
			'update_user' => 'Update User',
			'update_time' => 'Update Time',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('student_id',$this->student_id);
		$criteria->compare('exam_id',$this->exam_id);
		$criteria->compare('subject_id',$this->subject_id);
		$criteria->compare('score',$this->score);
		$criteria->compare('number',$this->number,true);
		$criteria->compare('score1',$this->score1);
		$criteria->compare('score2',$this->score2);
		$criteria->compare('school_id',$this->school_id);
		$criteria->compare('create_user',$this->create_user);
		$criteria->compare('create_time',$this->create_time);
		$criteria->compare('update_user',$this->update_user);
		$criteria->compare('update_time',$this->update_time);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}